const fs = require('fs')
const zlib = require('zlib')

const gzip = zlib.createGzip()
fs.writeFileSync('./message.txt', 'Hello World!',(err) => {
  if (err) console.log(err);
  console.log('文件创建成功');
})
const readStream = fs.createReadStream('./message.txt')
const writeStream = fs.createWriteStream('./message2.gzip')

readStream
.pipe(gzip)
.pipe(writeStream)
